package com.kai.Controller;


import com.kai.service.UserService;
import com.kai.service.impl.UserServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Scanner;

@Component
public class Login {

    @Autowired
    private UserService userService;


    Scanner sc = new Scanner(System.in);
    public void logging() {

        System.out.println("请输入用户名>: ");
        String username = sc.next();
        System.out.println("请输入密码>: ");
        String password = sc.next();

        if(userService.containUser(username,  password)){
            System.out.println("登录成功");
        }else {
            System.out.println("账户或密码错误");
        }

    }


}
